<?php
/**
 * Bdat Site development
 * @author Will Skates
 */

/*----------------------------------------------------------------------------------------------------*/

/**
 * Outline of properties and functionality required to manage aggregated tweets within the system.
 * @author Will Skates
 */
require_once('showcaseadmin.php');
class TweetAdmin extends ShowcaseAdmin {
	
	/*
	 * Lists of url's where those actions can be performed.
	 * @see ShowcaseAdmin::$listLinks
	 */
	public $listLinks = array(
		array('show/tweet/approve'),
		array('show/tweet/unapprove','show/tweet/publish'),
		array('show/tweet/unpublish','show/tweet/sticky'),
		array('show/tweet/unsticky')
	);
	
	/*----------------------------------------------------------------------------------------------------*/
	
	//What to call this content type (as it has a custom cms).
	public $referenceName = 'Tweet';
	
	//The current mode that the page is on.
	public $currentMode = false;
	public $roleRequired;
	
	//Where to find data relating to this content type.
	public $ctable = 'tweets';
	
	/*----------------------------------------------------------------------------------------------------*/
	
	/**
	 * (non-PHPdoc)
	 * @see ShowcaseAdmin::makeListQuery()
	 */
	public function makeListQuery()
	{
		$query = 'SELECT 
						tweets.uid,
						author,
						title,
						content,
						timestamp,
						user_profiles.name,
						user_profiles.link,
						gradyears.date AS gradyear
				 FROM tweets
				 LEFT JOIN user_profiles ON user_profiles.userid = ' . $this->ctable . '.author
				 LEFT JOIN gradyears ON gradyears.uid = user_profiles.gradyear
				 WHERE ' . $this->listWheres[$this->currentMode];
		return $query;
	}
	
	/*----------------------------------------------------------------------------------------------------*/
	
}